/******************* 公共变量 *******************/
var $meetingNum = $('#meetingNum'),
	$dateTime = $('body .wrap .invite-index section .con .time input'),
	$pickerBac = $('body .picker-bac'),
	$meeting = $('html body .wrap .invite-index .type .con .selection span:nth-child(2)'),
	$theme = $('html body .wrap .invite-index section .con a'),
	$position = $('html body .wrap .invite-index .detail .con .position em'),
	$time = $('html body .wrap .invite-index section .con .time em'),
	$timeBox = $('html body .wrap .invite-index section .con .time'),
	$envelope = $('html body .wrap .invite-index .envelope .con .input input'),
	$mate = $('html body .wrap .invite-index .object .check span'),
	meetingJudge,
	inviteObj = core.ls('inviteObj', 'o') || {},
	permissionObj = core.ls('permissionObj', 'o') || {},
	nowDate = null,
	setDate = null,
	minDate = null,
	maxDate = null,
	timeList,
	timer,
	preActiveFrame,
	nowActiveFrame,
	preActiveHour,
	nowActiveHour,
	frameType,
	pickerNowDate,
	envelopeData,
	inviteJudge = true;
console.log(inviteObj)

// 点击返回键时，清除本地存储
common.beforeBack = function () {
	core.lsDel('inviteObj', 'remove');
	core.lsDel('permissionObj', 'remove');
}

// 获取当前时间
function getNowDate(nowDate) {
	var date = nowDate || new Date(),
		dateDetail = core.dateDetail(date),
		dateArr = [dateDetail.year.toString(), dateDetail.mon, dateDetail.date.toString(), dateDetail.hour.toString(), dateDetail.min.toString()];
	return [date, dateDetail, dateArr];
}

/******************* 载入本地存储数据 *******************/
// var cookieData = core.getCookie(['inveteTheme', 'inveteDrink']);
$theme.attr({
	theme: inviteObj.inviteTheme,
	drink: inviteObj.inviteDrink
});
if (inviteObj.cate) {
	$('html body .wrap .invite-index .type .con .selection span').eq(Number(inviteObj.cate)).addClass('active');
	// (inviteObj.cate == 1) && (inviteObj.people && $('html body .wrap .invite-index .type .con .selection span:nth-child(2)').attr('people', inviteObj.people));
}
inviteObj.object && $('html body .wrap .invite-index .object .con .selection span').eq(Number(inviteObj.object)).addClass('active');
inviteObj.titleName && $('html body .wrap .invite-index .theme .con a em').html(inviteObj.titleName);
inviteObj.mate && $('html body .wrap .invite-index .object .check span').addClass(inviteObj.mate).attr('is_mate', '1');
inviteObj.type && $('html body .wrap .invite-index .anonymity .check span').addClass(inviteObj.type);
// inviteObj.join && $('html body .wrap .invite-index section .con .input:nth-child(1) input').val(inviteObj.join);
// inviteObj.gift && $('html body .wrap .invite-index section .con .input:nth-child(2) input').val(inviteObj.gift);
inviteObj.site && $position.html(inviteObj.site);
inviteObj.city && $position.attr('city', inviteObj.city);
inviteObj.siteAdd && $position.attr('address', inviteObj.siteAdd);
inviteObj.sitePoint && $position.attr('longitude', inviteObj.sitePoint.lng);
inviteObj.sitePoint && $position.attr('latitude', inviteObj.sitePoint.lat);
// setDate = inviteObj.timeArr ? new Date(Number(inviteObj.timeArr[0]), Number(inviteObj.timeArr[1]) - 1, Number(inviteObj.timeArr[2]), Number(inviteObj.timeArr[3]), Number(inviteObj.timeArr[4]), 0) : null;
setDate = inviteObj.timeArr ? new Date(Number(inviteObj.timeArr[0]), Number(inviteObj.timeArr[1]), Number(inviteObj.timeArr[2]), Number(inviteObj.timeArr[3]), Number(inviteObj.timeArr[4]), 0) : null;
inviteObj.selectedUpdateTime && $dateTime.attr('start_time', inviteObj.selectedUpdateTime);
inviteObj.selectedShowTime && $time.html(inviteObj.selectedShowTime);
minDate = inviteObj.minDate ? new Date(Number(inviteObj.minDate[0]), Number(inviteObj.minDate[1]), Number(inviteObj.minDate[2]), Number(inviteObj.minDate[3]), Number(inviteObj.minDate[4]), 0) : null;
maxDate = inviteObj.maxDate ? new Date(Number(inviteObj.maxDate[0]), Number(inviteObj.maxDate[1]), Number(inviteObj.maxDate[2]), Number(inviteObj.maxDate[3]), Number(inviteObj.maxDate[4]), 0) : null;
if (inviteObj.who_see) {
	$('html body .wrap .invite-index section .con .permission em').html(['公开', '部分可见', '不给谁看'][Number(inviteObj.who_see - 1)]).attr('who_see', inviteObj.who_see);
}

/******************* 页面数据载入 *******************/
$.ajax({
	url: inviteDataUrl,
	type: 'post',
	// data: {
	// 	id: _this.id
	// },
	success: function(data) {
		console.log(data)
		envelopeData = data.data;
		// 类别选择
		core.tabSwitch({
			tit: 'html body .wrap .invite-index .type .con .selection',
			selector: 'span',
			event: 'tap',
			active: false
		}, function ($this, thisIndex, $thisCon, beforeIndex, isInit) {
			// if (thisIndex) {
			// 	$meetingNum.picker('open');
			// }
			if (!isInit) {
				console.log(envelopeData)
				if (envelopeData) {
					$envelope.val(thisIndex ? envelopeData.ju_money : envelopeData.yue_money);
					inviteObj.cate = thisIndex.toString();
					core.ls('inviteObj', 'o', inviteObj);
				}
			}
		});
		inviteObj.cate && ((inviteObj.cate == 1) ? $envelope.val(data.data.ju_money) : $envelope.val(data.data.yue_money));
	}
});

$.ajax({
	url: userInfoUrl,
	type: 'post',
	success: function (data) {
		console.log(data)
		!inviteObj.object && ((data.list.sex == 1) ? $('html body .wrap .invite-index .object .con .selection span').eq(0).addClass('active') : $('html body .wrap .invite-index .object .con .selection span').eq(1).addClass('active'));
	}
});

/******************* 创建页面弹窗 *******************/
// 弹窗公共函数
// 关闭弹窗的功能
$('body').on('tap', '.picker-columns .bar-nav .cancel', closeFun);
$pickerBac.on('tap', closeFun);
$('html body').on('tap', '.date-time .picker-footer .confirm', closeFun);

function closeFun() {
	var $picker = $('body .picker-columns');
	if ($picker.hasClass('meeting-num')) {
		// $meetingNum.picker('close');
	} else if ($picker.hasClass('date-time')) {
		$dateTime.picker('close');
	}
}

$('body').on('tap', '.picker-columns .cancel', function () {
	meetingJudge = false;
	closeFun();
});

// 人数选择弹窗
var meetingPeople = [];
for (var i = 1; i < 100; i++) {
	meetingPeople.push(i);
}
// 点击人数选择确认按钮
$('body').on('tap', '.meeting-num .confirm', function () {
	common.layerConfirm({
		className: 'meeting-confirm',
		content: '邀约' + $('html body .picker-columns .picker-items .picker-items-col:nth-child(2) .picker-items-col-wrapper .picker-selected').html() + '位玩伴需要准备' + $('html body .picker-columns .picker-items .picker-items-col:nth-child(2) .picker-items-col-wrapper .picker-selected').html() + '份见面礼哟！',
		shadeClose: function () {
			meetingJudge = false;
		},
		yes: function () {
			meetingJudge = true;
		},
		no: function () {
			meetingJudge = false;
		},
		success: function (ele) {
			$(ele).css('zIndex', 19891017);
		}
	});
});

// $meetingNum.picker({
// 	toolbarTemplate: '<header class="bar bar-nav">选择邀约人数  人</header>\
// 	<footer class="picker-footer">\
// 		<span class="cancel">取消</span>\
// 		<span class="confirm">确定</span>\
// 	</footer>',
// 	cssClass: 'meeting-num',
// 	cols: [
// 		{
// 			textAlign: 'center',
// 			values: ['请选择邀约人数'],
// 		},
// 		{
// 			textAlign: 'center',
// 			values: meetingPeople,
// 		}
// 	],
// 	onChange: function (picker) {
// 		$('html body .meeting-num .bar-nav').html('选择邀约人数 ' + picker.cols[1].value + ' 人');
// 	},
// 	onOpen: function () {
// 		common.pickerBacIn();
// 		inviteObj.people && $meetingNum.picker("setValue", ['请选择邀约人数', inviteObj.people]);
// 	},
// 	onClose: function (picker) {
// 		common.pickerBacOut();
// 		if (meetingJudge) {
// 			$meeting.attr('people', picker.cols[1].value);
// 			inviteObj.people = picker.cols[1].value;
// 			core.ls('inviteObj', 'o', inviteObj);
// 		}
// 	}
// });

// 时间选择
function createTime() {
	pickerNowDate = getNowDate(),
	minArr = [];
	for (var i = 0; i < 60; i++) {
		minArr[i] = core.doubleDigit(i);
	}
	if (pickerNowDate[1].hour >= 6) {
		frameType = true;
		return [['今晚', '凌晨'], [['18', '19', '20', '21', '22', '23'], ['00', '01', '02', '03', '04', '05']], minArr];
	} else if ((Number(pickerNowDate[1].hour) >= 0) && (Number(pickerNowDate[1].hour) < 6)) {
		frameType = false;
		return [['凌晨'], [['0', '1', '2', '3', '4', '5']], minArr];
	}
}
timeList = createTime();
$timeBox.on('tap', function () {
	$dateTime.picker('open');
});
$dateTime.picker({
	toolbarTemplate: '<header class="bar bar-nav">请选择时间</header>\
	<footer class="picker-footer">\
		<span class="confirm">确定</span>\
	</footer>',
	cssClass: 'date-time',
	cols: [
		{
			textAlign: 'center',
			values: timeList[0],
		},
		{
			textAlign: 'center',
			values: timeList[1][0]
		},
		{
			textAlign: 'center',
			values: timeList[2]
		}
	],
	onChange: function (picker) {
		if (frameType) {
			nowActiveFrame = picker.cols[0].activeIndex;
			nowActiveHour = picker.cols[1].activeIndex;

			if (nowActiveFrame != preActiveFrame) {
				clearTimeout(timer);

				timer = setTimeout(function () {
					preActiveFrame = nowActiveFrame;
					picker.cols[1].replaceValues(timeList[1][nowActiveFrame]);
					picker.updateValue();
					$time.html(picker.displayValue[0] + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
					var $selectCon = $('html body .date-time .picker-items .picker-center-highlight, .picker-item'),
						selectConHeight = core.decimalRound($selectCon.height(), 0) + 'px';
					$selectCon.css({
						height: selectConHeight,
						lineHeight: selectConHeight
					});
				}, 200);
			}
		}

		$('html body .date-time .bar-nav').html();
		setTimeout(function () {
			$time.html(picker.displayValue[0] + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		}, 5);

		if (picker.cols[0].activeIndex) {
			var showDate = core.dateDetail(new Date((new Date()).getTime() + 86400000));
			$('html body .date-time .bar-nav').html(showDate.ymd2 + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		} else {
			var showDate = core.dateDetail();
			$('html body .date-time .bar-nav').html(showDate.ymd2 + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		}
	},
	onOpen: function (picker) {
		var $selectCon = $('html body .date-time .picker-items .picker-center-highlight, .picker-item'),
			selectConHeight = core.decimalRound($selectCon.height(), 0) + 'px';
		// console.log($selectCon)
		$selectCon.css({
			height: selectConHeight,
			lineHeight: selectConHeight
		});
		common.pickerBacIn();
		if (frameType) {
			preActiveFrame = picker.cols[0].activeIndex;
			preActiveHour = picker.cols[1].activeIndex;
		}
		$time.html(picker.displayValue[0] + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);

		if (picker.cols[0].activeIndex) {
			var showDate = core.dateDetail(new Date((new Date()).getTime() + 86400000));
			$('html body .date-time .bar-nav').html(showDate.ymd2 + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		} else {
			var showDate = core.dateDetail();
			$('html body .date-time .bar-nav').html(showDate.ymd2 + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		}
	},
	onClose: function (picker) {
		common.pickerBacOut();
		if (frameType) {
			cityActiveIndex = picker.cols[0].activeIndex;
			areaActiveIndex = picker.cols[1].activeIndex;
		}
		if (picker.cols[0].activeIndex) {
			nowDate = getNowDate(new Date((new Date()).getTime() + 86400000));
		} else {
			nowDate = getNowDate();
		}
		inviteObj.selectedTime = nowDate[1].ymd2 + ' ' + nowDate[1].hour + ':' + nowDate[1].min;
		inviteObj.selectedShowTime = picker.displayValue[0] + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2];
		inviteObj.selectedUpdateTime = nowDate[1].ymd2 + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2] + ':' + '00';
		$dateTime.attr('start_time', inviteObj.selectedUpdateTime);
		if (picker.cols[0].activeIndex) {
			var dateTmp = core.dateDetail(new Date(nowDate[0].getTime() + 86400000));
			setDate = new Date(Number(dateTmp.year), Number(dateTmp.mon) - 1, Number(dateTmp.date), Number(picker.value[1]), Number(picker.value[2]), 0);
		} else {
			setDate = new Date(Number(nowDate[1].year), Number(nowDate[1].mon) - 1, Number(nowDate[1].date), Number(picker.value[1]), Number(picker.value[2]), 0);
		}
		inviteObj.timeArr = [Number(nowDate[1].year), nowDate[1].mon, nowDate[1].date, Number(picker.value[1]), Number(picker.value[2]), 0];

		// if (setDate.getTime() < nowDate[0].getTime()) {
		// 	core.layerHint('活动时间至少提前1小时哦~');
		// 	// $dateTime.picker("setValue", getNowDate()[2]);
		// }
		// minDate = new Date(nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date), 18, 0, 0);
		// maxDate = new Date(nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date) + 1, 6, 0, 0);
		// inviteObj.minDate = [nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date), 18, 0, 0];
		// inviteObj.maxDate = [nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date) + 1, 6, 0, 0];
		if (setDate.getTime() < (new Date((new Date()).getTime() + 1800000)).getTime()) {
			core.layerHint('活动时间至少提前半小时哦');
		}

		$time.html(picker.displayValue[0] + ' ' + picker.displayValue[1] + ':' + picker.displayValue[2]);
		core.ls('inviteObj', 'o', inviteObj);
	}
});

// $dateTime.datetimePicker({
// 	toolbarTemplate: '<header class="bar bar-nav">请选择时间</header>\
// 	<footer class="picker-footer">\
// 		<span class="confirm">确定</span>\
// 	</footer>',
// 	cssClass: 'date-time',
// 	// value: inviteObj.timeArr ? inviteObj.timeArr : getNowDate()[2],
// 	// value: inviteObj.timeArr,
// 	onOpen: function () {
// 		common.pickerBacIn();
// 		inviteObj.timeArr && $dateTime.picker("setValue", inviteObj.timeArr);
// 	},
// 	onClose: function (picker) {
// 		common.pickerBacOut();
// 		inviteObj.timeArr = picker.value;
// 		console.log(picker.value)
// 		nowDate = getNowDate();
// 		setDate = new Date(Number(picker.value[0]), Number(picker.value[1]) - 1, Number(picker.value[2]), Number(picker.value[3]), Number(picker.value[4]), nowDate[1].sec);

// 		// if (setDate.getTime() < nowDate[0].getTime()) {
// 		// 	core.layerHint('活动时间至少提前1小时哦~');
// 		// 	// $dateTime.picker("setValue", getNowDate()[2]);
// 		// }
// 		minDate = new Date(nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date), 18, 0, 0);
// 		maxDate = new Date(nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date) + 1, 6, 0, 0);
// 		inviteObj.minDate = [nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date), 18, 0, 0];
// 		inviteObj.maxDate = [nowDate[1].year, Number(nowDate[1].mon) - 1, Number(nowDate[1].date) + 1, 6, 0, 0];
// 		if (!((setDate.getTime() > minDate.getTime()) && (maxDate.getTime() > setDate.getTime()))) {
// 			core.layerHint('活动时间需要在当天18点到第二天6点之间哦~');
// 		} else if (setDate.getTime() < (new Date((new Date()).getTime() + 1800000)).getTime()) {
// 			core.layerHint('活动时间至少提前半小时哦')
// 		}

// 		core.ls('inviteObj', 'o', inviteObj);
// 	}
// });

/******************* 保存输入的红包 *******************/
$('html body .wrap .invite-index section .con .input input').on('blur', function () {
	var $this = $(this);
	if ($this.parent().index()) {
		inviteObj.gift = $this.val();
		core.ls('inviteObj', 'o', inviteObj);
	} else {
		inviteObj.join = $this.val();
		core.ls('inviteObj', 'o', inviteObj);
	}
});

/******************* 单选框选择 *******************/
// 对象选择
core.tabSwitch({
	tit: 'html body .wrap .invite-index .object .con .selection',
	selector: 'span',
	event: 'tap',
	active: false
}, function ($this, thisIndex, $thisCon, beforeIndex, isInit) {
	if (!isInit) {
		inviteObj.object = thisIndex.toString();
		if (thisIndex == 1) {
			if ($mate.hasClass('active')) {
				$mate.removeClass('active');
				$mate.attr('is_mate', '0');
				inviteObj.mate = '';
			}
		}
		core.ls('inviteObj', 'o', inviteObj);
	}
});

/******************* 选择框勾选 *******************/
// 携带闺蜜
// core.addSelection({
// 	ele: 'html body .wrap .invite-index .object .check span',
// 	event: 'tap',
// 	multiple: true
// }, function($this, index) {
// 	$this.hasClass('active') ? $this.attr('is_mate', '1') : $this.attr('is_mate', '0');
// 	inviteObj.mate = $this[0].className;
// 	core.ls('inviteObj', 'o', inviteObj);
// });
$mate.on('tap', function () {
	if ($('html body .wrap .invite-index .object .con .selection .active').index() != 1) {
		if ($mate.hasClass('active')) {
			$mate.removeClass('active');
			$mate.attr('is_mate', '0');
			inviteObj.mate = '';
		} else {
			$mate.addClass('active');
			$mate.attr('is_mate', '1');
			inviteObj.mate = 'active';
		}
		core.ls('inviteObj', 'o', inviteObj);
	}
});

// 匿名发布
core.addSelection({
	ele: 'html body .wrap .invite-index .anonymity .check span',
	event: 'tap',
	multiple: true
}, function($this, index) {
	$this.hasClass('active') ? $this.attr('type', 0) : $this.attr('type', 1);
	inviteObj.type = $this[0].className;
	core.ls('inviteObj', 'o', inviteObj);
});

/******************* 收集页面数据 *******************/
var collect = core.collectData({
	html: {
		site: 'html body .wrap .invite-index .detail .con .position em'
	},
	val: {
		// start_time: 'html body .wrap .invite-index section .con strong input',
		// join_money: 'html body .wrap .invite-index .envelope .con .input:nth-child(1) input',
		// gift: 'html body .wrap .invite-index .envelope .con .input:nth-child(2) input'
	},
	attr: {
		theme: 'html body .wrap .invite-index .theme .con a',
		// drink: 'html body .wrap .invite-index .theme .con a',
		type: 'html body .wrap .invite-index .anonymity .check span',
		who_see: 'html body .wrap .invite-index section .con .permission em',
		is_mate: 'html body .wrap .invite-index .object .check span',
		start_time: 'html body .wrap .invite-index section .con strong input',
		address: $position,
		longitude: $position,
		latitude: $position,
		city: $position
	},
	select: {
		attr: {
			cate: {
				ele: 'html body .wrap .invite-index .type .con .selection span',
				className: 'active'
			},
			sex: {
				ele: 'html body .wrap .invite-index .object .con .selection span',
				className: 'active'
			},
			// people: {
			// 	ele: 'html body .wrap .invite-index .type .con .selection span',
			// 	className: 'active'
			// }
		}
	}
});

/******************* 数据验证并上传 *******************/
// core.vForm();
// vForm.rule([{
// 	ele: 'html body .wrap .invite-index .detail .con .time input',
// 	verify: core.emptyJudge,
// 	error: '请选择活动时间~'
// },
// // {
// // 	ele: 'html body .wrap .invite-index section .con .input:nth-child(1) input',
// // 	verify: core.isIntDecimal,
// // 	error: '报名红包必须为数字哦~'
// // },
// // {
// // 	ele: 'html body .wrap .invite-index section .con .input:nth-child(2) input',
// // 	verify: function (num) {
// // 		if (core.isIntDecimal(num)) {
// // 			if (Number(num) > 200) {
// // 				return true;
// // 			} else {
// // 				core.layerHint('见面礼红包必须大于200元哦~');
// // 				return false;
// // 			}
// // 		} else {
// // 			core.layerHint('见面礼红包必须为数字哦~');
// // 		}
// // 	}
// // }
// ], {
// 	submit: 'html body .wrap .invite-index .release',
// 	subFun:function ($this) {
// 		var data = collect.collection();

// 		if (inviteJudge) {
// 			if (data.cate) {
// 				if (data.cate == '2') {
// 					if (data.people == 0) {
// 						core.layerHint('请选择聚会人数');
// 						return false;
// 					}
// 				}
// 				if (data.theme) {
// 					if (data.sex) {
// 						if (data.site) {
// 							// if ((setDate.getTime() > minDate.getTime()) && (maxDate.getTime() > setDate.getTime())) {
// 								if (setDate.getTime() >= (new Date((new Date()).getTime() + 1800000)).getTime()) {
// 									if (data.who_see) {
// 										inviteObj.users && (data.users = inviteObj.users);
// 										console.log(data)
// 										inviteJudge = false;
// 										ajax.load({
// 											url: hostUrl + 'Activity/add',
// 											type: 'post',
// 											data: data,
// 											callback: function (data) {
// 												inviteJudge = true;
// 												console.log(data)
// 												core.layerHint(data.message);
// 												if (data.status && (data.status == 1)) {
// 													core.lsDel('inviteObj', 'remove');
// 													setTimeout(function () {
// 														core.href(invite_cash + '?res_id=' + data.res_id + '&res_money=' + data.res_money + '&res_time=' + data.res_time + '&my_yu_money=' + data.my_yu_money);
// 													}, 1000);
// 												}
// 											}
// 										});
// 									} else {
// 										core.layerHint('请选择谁可以看~');
// 									}
// 								} else {
// 									core.layerHint('活动时间至少提前半小时哦')
// 								}
// 							// } else {
// 								// core.layerHint('活动时间需要在当天18点到第二天6点之间哦~');
// 							// }
// 						} else {
// 							core.layerHint('请选择活动地点');
// 						}
// 					} else {
// 						core.layerHint('请选择邀约对象');
// 					}
// 				} else {
// 					core.layerHint('请选择活动主题');
// 				}
// 			} else {
// 				core.layerHint('请选择邀约类别');
// 			}
// 		}
// 	}
// });

$('html body .wrap .invite-index .release').on('tap', function () {
	var data = collect.collection();
	console.log(data)
	if (inviteJudge) {
		if (data.cate) {
			// if (data.cate == '2') {
			// 	if (data.people == 0) {
			// 		core.layerHint('请选择聚会人数');
			// 		return false;
			// 	}
			// }
			if (data.theme) {
				if (data.sex) {
					if (data.site) {
						// if ((setDate.getTime() > minDate.getTime()) && (maxDate.getTime() > setDate.getTime())) {
							if (setDate) {
								if (setDate.getTime() >= (new Date((new Date()).getTime() + 1800000)).getTime()) {
									if (data.who_see) {
										inviteObj.users && (data.users = inviteObj.users);
										console.log(data)
										inviteJudge = false;
										ajax.load({
											url: addActivityUrl,
											type: 'post',
											data: data,
											callback: function (data) {
												inviteJudge = true;
												console.log(data)
												
												if (data.status) {
													if (data.status == 1) {
														core.lsDel('inviteObj', 'remove');
														core.lsDel('permissionObj', 'remove');
														// setTimeout(function () {
														core.href(invite_cash + '?res_id=' + data.res_id);
														// }, 1000);
													} else if (data.status == 2) {
														core.hintHref('账号因爽约被临时冻结，需支付诚意金才能解冻账号', invite_cash + '?res_id=0');
													}
												} else {
													core.layerHint(data.message);
												}
											}
										});
									} else {
										core.layerHint('请选择谁可以看~');
									}
								} else {
									core.layerHint('活动时间至少提前半小时哦');
								}
							} else {
								core.layerHint('请选择邀约时间');
							}
						// } else {
							// core.layerHint('活动时间需要在当天18点到第二天6点之间哦~');
						// }
					} else {
						core.layerHint('请选择活动地点');
					}
				} else {
					core.layerHint('请选择邀约对象');
				}
			} else {
				core.layerHint('请选择活动主题');
			}
		} else {
			core.layerHint('请选择邀约类别');
		}
	}
});
